package com.frogs.ucenter.v1.request;

import javax.servlet.http.HttpServletRequest;

import com.frogs.framework.web.HttpRequestInfo;
import com.frogs.system.util.ApiUrlParamEnum;
import com.frogs.system.web.api.request.Request;
import com.frogs.system.web.exception.RequestIllegalException;

/**
 * 商品评价评论内容请求参数类
 *
 * @author lijian
 * @version 2014年3月18日 - 上午10:31:17
 */
public class GoodsEvaluateCommentListRequest extends Request {

	/**
	 * 商品评价ID
	 */
	private int goodsEvaluateId;
	/** 
	 * 当前页码 
	 */
	private int pageNum = 1;
	/**
	 * 每页条数 
	 */
	private int numPerPage = 10;
	
	public GoodsEvaluateCommentListRequest(){
		
	}
	
	@Override
	public void parse(HttpServletRequest request) {
		HttpRequestInfo requestInfo = new HttpRequestInfo(request);
		this.goodsEvaluateId = requestInfo.getIntParameter(ApiUrlParamEnum.goodsEvaluateId.getParamName(), 0);
		this.pageNum = requestInfo.getIntParameter(ApiUrlParamEnum.pageNo.getParamName(),1);
		this.numPerPage = requestInfo.getIntParameter(ApiUrlParamEnum.pageSize.getParamName(), 10);
		if (goodsEvaluateId < 1) {
			throw new RequestIllegalException("error goodsEvaluateId: " + goodsEvaluateId);
		}
		if (pageNum < 1) {
			throw new RequestIllegalException("error pageNum:" + pageNum);
		}
		
		if (numPerPage < 1) {
			throw new RequestIllegalException("error numPerPage:" + numPerPage);
		}
	}

	public int getGoodsEvaluateId() {
		return goodsEvaluateId;
	}

	public void setGoodsEvaluateId(int goodsEvaluateId) {
		this.goodsEvaluateId = goodsEvaluateId;
	}

	public int getPageNum() {
		return pageNum;
	}

	public void setPageNum(int pageNum) {
		this.pageNum = pageNum;
	}

	public int getNumPerPage() {
		return numPerPage;
	}

	public void setNumPerPage(int numPerPage) {
		this.numPerPage = numPerPage;
	}

}
